#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main()
{
    pid_t pid;
    if((pid = fork()) < 0)
    {
        perror("fork error");
    }

    else if(pid == 0)
    {
        printf("child getpid()=%d\n",getpid());
    }

    else if(pid > 0)
    {
        printf("parent getpid() = %d\n",getpid());
    }
    return 0;
}
